<!--
*Author：DGZ
 **  contact:service@dagongzao.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/sys/Sys_Dictionary.jsx此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :details="details"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/sys/Sys_Dictionary.jsx";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'DictionaryId',
                footer: "Foots",
                cnName: '字典数据',
                name: 'Sys_Dictionary',
                newTabEdit: false,
                url: "/Sys_Dictionary/",
                sortName: "DictionaryId"
            });
            const editFormFields = ref({"DictionaryNo":"","DictionaryName":"","ParentId":"","DBServer":"","OrderNo":"","Enabled":"","DbSql":""});
            const editFormOptions = ref([[{"title":"字典编号","required":true,"field":"DictionaryNo"},
                               {"title":"字典名称","required":true,"field":"DictionaryName"},
                               {"title":"父级ID","required":true,"field":"ParentId","type":"number"}],
                              [{"dataKey":"dbServer","data":[],"title":"所在数据库","field":"DBServer","type":"select"},
                               {"title":"排序号","field":"OrderNo","type":"number"},
                               {"dataKey":"enabled","data":[],"title":"是否启用","required":true,"field":"Enabled","type":"select"}],
                              [{"title":"sql语句","field":"DbSql","colSize":8,"type":"textarea"}]]);
            const searchFormFields = ref({"DictionaryNo":"","DictionaryName":"","ParentId":"","Enabled":"","CreateTime":"","ModifyTime":""});
            const searchFormOptions = ref([[{"title":"字典编号","field":"DictionaryNo","type":"like"},{"title":"字典名称","field":"DictionaryName","type":"like"},{"title":"父级ID","field":"ParentId","type":"number"}],[{"dataKey":"enabled","data":[],"title":"是否启用","field":"Enabled","type":"select"},{"title":"创建时间","field":"CreateTime","type":"datetime"},{"title":"修改时间","field":"ModifyTime","type":"datetime"}]]);
            const columns = ref([{field:'DictionaryId',title:'字典ID',type:'int',width:90,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'DictionaryNo',title:'字典编号',type:'string',width:90,require:true,sort:true,align:'left'},
                       {field:'DictionaryName',title:'字典名称',type:'string',link:true,width:140,require:true,sort:true,align:'left'},
                       {field:'ParentId',title:'父级ID',type:'int',width:90,require:true,align:'left'},
                       {field:'DictionaryConfig',title:'配置项',type:'string',width:300,hidden:true,align:'left'},
                       {field:'DbSql',title:'sql语句',type:'string',width:200,align:'left'},
                       {field:'DBServer',title:'所在数据库',type:'string',bind:{ key:'dbServer',data:[]},width:90,hidden:true,align:'left'},
                       {field:'OrderNo',title:'排序号',type:'int',width:90,align:'left'},
                       {field:'Enabled',title:'启用',type:'sbyte',bind:{ key:'enabled',data:[]},width:90,require:true,align:'left'},
                       {field:'CreateId',title:'创建人编号',type:'int',width:90,hidden:true,align:'left'},
                       {field:'Remarks',title:'备注',type:'string',width:120,align:'left'},
                       {field:'Creator',title:'创建人',type:'string',width:130,hidden:true,readonly:true,align:'left'},
                       {field:'CreateTime',title:'创建时间',type:'datetime',width:150,readonly:true,sort:true,align:'left'},
                       {field:'ModifyId',title:'修改人编号',type:'int',width:90,hidden:true,align:'left'},
                       {field:'Modifier',title:'修改人',type:'string',width:130,hidden:true,readonly:true,align:'left'},
                       {field:'ModifyTime',title:'修改时间',type:'datetime',width:150,readonly:true,align:'left'}]);
            const detail = ref(  {
                    cnName: '字典明细',
                    table: 'Sys_DictionaryList',
                    columns: [{field:'DictionaryListId',title:'DictionaryListId',type:'int',width:90,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'DictionaryId',title:'数据源ID',type:'int',width:90,readonly:true,align:'left'},
                       {field:'DictionaryValue',title:'数据源Value',type:'string',width:90,edit:{type:'text'},align:'left'},
                       {field:'DictionaryName',title:'数据源Text',type:'string',width:90,edit:{type:'text'},align:'left'},
                       {field:'OrderNo',title:'排序号',type:'int',width:90,edit:{type:'text'},align:'left'},
                       {field:'Enabled',title:'启用',type:'sbyte',bind:{ key:'enabled',data:[]},width:90,edit:{type:'switch'},align:'left'},
                       {field:'CreateId',title:'创建人编号',type:'int',width:90,hidden:true,align:'left'},
                       {field:'Creator',title:'创建人',type:'string',width:130,readonly:true,align:'left'},
                       {field:'CreateTime',title:'创建时间',type:'datetime',width:90,readonly:true,align:'left'},
                       {field:'ModifyId',title:'修改人编号',type:'int',width:90,hidden:true,align:'left'},
                       {field:'Modifier',title:'修改人',type:'string',width:130,align:'left'},
                       {field:'ModifyTime',title:'修改时间',type:'datetime',width:90,align:'left'},
                       {field:'Remarks',title:'备注',type:'string',width:120,align:'left'},
                       {field:'IsValid',title:'逻辑删除',type:'int',width:120,hidden:true,require:true,align:'left'}],
                    sortName: 'DictionaryListId',
                    key: 'DictionaryListId'
                                            });
            const details = ref([]);
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
                details
            };
        },
    });
</script>
